home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / Documents / NeXTAnswers / sysadmin.344 < prev    next >
Text File  |  1992-02-06  |  2KB  |  72 lines

  1. {\rtf0\ansi{\fonttbl\f3\fnil Times-Roman;\f0\fmodern Courier;}
  2. \paperw9080
  3. \paperh5440
  4. \margl120
  5. \margr120
  6. \pard\tx960\tx1920\tx2880\tx3840\tx4800\tx5760\tx6720\tx7680\tx8640\tx9600\f3\b0\i0\ul0\fs24 NetInfo niutil mounts slashes\
  7. \
  8. Q: How do I access the individual 'mounts' database entries using niutil?\
  9. Because of the slashes in the property values, niutil doesn't seem to\
  10. understand....\
  11. \
  12. A: Indeed, if you try something straightforward like\
  13. \
  14.  
  15. \f0     niutil -read . /mounts//dev/sd0a\
  16.  
  17. \f3 \
  18. you'll get an error message such as\
  19. \
  20.  
  21. \f0     niutil: can't open .:/mounts//dev/rsd0a\
  22.  
  23. \f3 \
  24. because 
  25. \f0 niutil
  26. \f3  is using / to separate properties.  So, let's say we\
  27. have the following:\
  28. \
  29.  
  30. \f0     % niutil -list . /mounts\
  31.     133      /dev/sd0a \
  32.     134      /dev/sd0b \
  33.     137      /dev/sd1a \
  34.  
  35. \f3 \
  36. and we want to do an 
  37. \f0 niutil -read
  38. \f3  on the /dev/sd0a entry.  We have to\
  39. find some way to escape those /s in the property value (“/dev/sd0a”) or\
  40. we're sunk.  The simple ways don't work:\
  41. \
  42.  
  43. \f0     % niutil -read . /mounts\\/dev\\/rsd0a\
  44.     niutil: can't open .:/mounts/dev/rsd0a\
  45. \
  46.     % niutil -read . /mounts/'/dev/rsd0a'\
  47.     niutil: can't open .:/mounts//dev/rsd0a\
  48.  
  49. \f3 \
  50. Turns out it's necessary to use a DOUBLE \\ to get the proper escaping:\
  51. \
  52.  
  53. \f0     % niutil -read . /mounts/\\\\/dev\\\\/sd0a\
  54.     name: /dev/sd0a \
  55.     dir: / \
  56.     type: 4.3 \
  57.     opts: rw noquota noauto \
  58.     freq: 1 \
  59.     passno: 1 \
  60.  
  61. \f3 \
  62. Why?  Because if one types simply '\\/' the shell will gobble the escape character\
  63. (the \\), and transform this into '/'.  If one types TWO \\s, then the shell will turn\
  64. them into one, and there will be one in the string passed to niutil as its argument.\
  65. \
  66. QA344\
  67. \
  68. Valid for 1.0 \
  69. Valid for 2.0\
  70. \
  71.  
  72.